import logging
from typing import List

from apscheduler.schedulers.background import BackgroundScheduler

from app.web.crontab.BaseTask import BaseTask
from app.web.crontab.ResumeAnalysis import ResumeAnalysisTask

tasks: List[BaseTask] = []
logger = logging.getLogger(__name__)


def init_scheduled_tasks():
    scheduler = BackgroundScheduler()
    tasks.append(ResumeAnalysisTask())
    print("Start Scheduler")
    for task in tasks:
        scheduler.add_job(task.run, task.get_trigger(), **task.get_settings())
    scheduler.start()
